package com.bsoft.aidlservertest;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.support.annotation.Nullable;

import com.socks.library.KLog;

/**
 * Created by 泅渡者
 * Created on 2017/9/22.
 */

public class CalculateUtils extends Service {

    Binder mBinder = new  Calculate.Stub(){

        @Override
        public float addition(float arg1, float arg2) throws RemoteException {
            KLog.d("计算中");
            return arg1+arg2;
        }

        @Override
        public float subtraction(float arg1, float arg2) throws RemoteException {
            KLog.d("计算中");
            return arg1-arg2;
        }

        @Override
        public float multiplication(float arg1, float arg2) throws RemoteException {
            KLog.d("计算中");
            return arg1*arg2;
        }

        @Override
        public float division(float arg1, float arg2) throws RemoteException {
            KLog.d("计算中");
            return arg1/arg2;
        }
    };

    @Override
    public void onCreate() {
        super.onCreate();
        KLog.d("被执行");
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        KLog.d("被执行");
        return super.onStartCommand(intent, flags, startId);
    }


    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        KLog.d("被执行");
        return mBinder;
    }

    @Override
    public boolean onUnbind(Intent intent) {
        KLog.d("被执行");
        return super.onUnbind(intent);
    }
}
